<div class="col-xs-12">
	<div class="header lighter black">
		<div class="row" style="font-size:22px">
			<div class="col-md-2"><strong>{{migrationCluster.migrationCluster.clusterName}}</strong><strong ng-if="!migrationCluster.migrationCluster">Cluster deleted!!!</strong></div>
			<div class="col-md-2" ng-if="migrationCluster.migrationCluster">状态: 
			<span class="label label-sm" ng-class="{
						'label-default':migrationCluster.migrationCluster.statusType == 'Init',
						'label-info':migrationCluster.migrationCluster.statusType == 'Processing',
						'label-success':migrationCluster.migrationCluster.statusType == 'Success',
						'label-danger':migrationCluster.migrationCluster.statusType == 'Fail'
						}">
						{{migrationCluster.migrationCluster.status}}
			</span>
			</div>
			<div class="col-md-4" ng-if="migrationCluster.migrationCluster && migrationCluster.migrationCluster.publishInfo">
			发布结果: 
			<span class="label label-sm label-info"　
				  ng-class="{
						'label-default':migrationCluster.migrationCluster.statusType == 'Init',
						'label-info':migrationCluster.migrationCluster.statusType == 'Processing',
						'label-success':migrationCluster.migrationCluster.statusType == 'Success',
						'label-danger':migrationCluster.migrationCluster.statusType == 'Fail'
						}"
			ng-click="showPublishResult(migrationCluster.migrationCluster.publishInfo)">
					详情	
			</span>
			</div>
			<div class="col-md-4">
					<a type="button" class="btn btn-primary radius-border-fat"
						ng-click="continueMigrationCluster( migrationCluster.migrationCluster.migrationEventId,migrationCluster.migrationCluster.clusterId)"
						ng-if=" migrationCluster.migrationCluster && 
								!migrationCluster.migrationCluster.end">
						<span ng-if="!migrationCluster.migrationCluster.end">执行</span>
					</a>
					<a type="button" class="btn btn-danger radius-border-fat" 
						ng-click="cancelMigrationCluster( migrationCluster.migrationCluster.migrationEventId,migrationCluster.migrationCluster.clusterId)"
						ng-if="!migrationCluster.migrationCluster.end">
						<span>回滚</span>
					</a>
					<a type="button" class="btn btn-danger radius-border-fat"
					   ng-click="forcePublishMigrationCluster( migrationCluster.migrationCluster.migrationEventId,migrationCluster.migrationCluster.clusterId)"
					   ng-if="migrationCluster.migrationCluster.status == 'PartialSuccess'">
						<span>强制发布</span>
					</a>
					<a type="button" class="btn btn-danger radius-border-fat"
					   ng-click="forceEndMigrationCluster( migrationCluster.migrationCluster.migrationEventId,migrationCluster.migrationCluster.clusterId)"
					   ng-if="migrationCluster.migrationCluster.status == 'Publish'">
						<span>强制结束</span>
					</a>
				</div>
		</div>
	</div>

	<div class="panel panel-primary" style="margin-top: 15px;">
		<header class="panel-heading">
			<div class="row">
				<div class="col-md-3">源 :
					{{migrationCluster.migrationCluster.sourceDcName}} &nbsp&nbsp&nbsp
					目标 : {{migrationCluster.migrationCluster.destinationDcName}}</div>
				<div class="col-md-7">开始时间 :
					{{migrationCluster.migrationCluster.startTime | date:'yyyy-MM-dd HH:mm:ss'}} &nbsp&nbsp&nbsp 结束时间 :
					{{migrationCluster.migrationCluster.endTime | date:'yyyy-MM-dd HH:mm:ss'}}</div>
			</div>
		</header>

		<table class="table table-bordered table-hover">
			<thead>
				<tr>
					<th>Shard</th>
					<th>迁移检测</th>
					<th>原主机房预迁移</th>
					<th>目标主机房迁移</th>
					<th>其他机房迁移</th>
					<th>结果</th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="migrationShard in migrationCluster.migrationShards">
					<td>{{migrationShard.migrationShard.shard.shardName}}</td>
					<td>
						<div ng-model="migrationShard.status.steps.CHECK"
							ng-click="showLog(migrationShard.status.steps.CHECK)">
							<span class="label label-sm label-success"
								ng-if="migrationShard.status.steps.CHECK.true">Success</span> <span
								class="label label-sm label-danger"
								ng-if="migrationShard.status.steps.CHECK.false">Failed</span> <span
								class="label label-sm label-default"
								ng-if="!migrationShard.status.steps.CHECK">Waiting</span>
						</div>
					</td>
					<td>
						<div
							ng-model="migrationShard.status.steps.MIGRATE_PREVIOUS_PRIMARY_DC"
							ng-click="showLog(migrationShard.status.steps.MIGRATE_PREVIOUS_PRIMARY_DC)">
							<span class="label label-sm label-success"
								ng-if="migrationShard.status.steps.MIGRATE_PREVIOUS_PRIMARY_DC.true">Success</span>
							<span class="label label-sm label-danger"
								ng-if="migrationShard.status.steps.MIGRATE_PREVIOUS_PRIMARY_DC.false">Failed</span>
							<span class="label label-sm label-default"
								ng-if="!migrationShard.status.steps.MIGRATE_PREVIOUS_PRIMARY_DC">Waiting</span>
						</div>
					</td>
					<td>
						<div ng-model="migrationShard.status.steps.MIGRATE_NEW_PRIMARY_DC"
							ng-click="showLog(migrationShard.status.steps.MIGRATE_NEW_PRIMARY_DC)">
							<span class="label label-sm label-success"
								ng-if="migrationShard.status.steps.MIGRATE_NEW_PRIMARY_DC.true">Success</span>
							<span class="label label-sm label-danger"
								ng-if="migrationShard.status.steps.MIGRATE_NEW_PRIMARY_DC.false">Failed</span>
							<span class="label label-sm label-default"
								ng-if="!migrationShard.status.steps.MIGRATE_NEW_PRIMARY_DC">Waiting</span>
						</div>
					</td>
					<td>
						<div ng-model="migrationShard.status.steps.MIGRATE_OTHER_DC"
							ng-click="showLog(migrationShard.status.steps.MIGRATE_OTHER_DC)">
							<span class="label label-sm label-success"
								ng-if="migrationShard.status.steps.MIGRATE_OTHER_DC.true">Success</span>
							<span class="label label-sm label-danger"
								ng-if="migrationShard.status.steps.MIGRATE_OTHER_DC.false">Failed</span>
							<span class="label label-sm label-default"
								ng-if="!migrationShard.status.steps.MIGRATE_OTHER_DC">Waiting</span>
						</div>
					</td>
					<td>
						<div ng-model="migrationShard.status.steps.MIGRATE"
							ng-click="showLog(migrationShard.status.steps.MIGRATE)">
							<span class="label label-sm label-success"
								ng-if="migrationShard.status.steps.MIGRATE.true">Success</span>
							<span class="label label-sm label-danger"
								ng-if="migrationShard.status.steps.MIGRATE.false">Failed</span>
							<span class="label label-sm label-default"
								ng-if="!migrationShard.status.steps.MIGRATE">Waiting</span>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>

<xpipeconfirmdialog xpipe-dialog-id="'log'" xpipe-title="'迁移日志'"
	xpipe-detail="currentQueryLog" xpipe-show-cancel-btn="false"
	xpipe-confirm="hideLog"></xpipeconfirmdialog>
	
<xpipeconfirmdialog xpipe-dialog-id="'publishLog'" xpipe-title="'发布结果'"
	xpipe-detail="publishInfo" xpipe-show-cancel-btn="false"
	xpipe-confirm="hidePublishLog"></xpipeconfirmdialog>